package com.zzyl.controller;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.dto.AlertDataHandleDto;
import com.zzyl.dto.AlertDataPageQueryDto;
import com.zzyl.service.AlertDataService;
import com.zzyl.vo.AlertDataVo;
import com.zzyl.vo.AlertRuleVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.print.attribute.standard.PrinterURI;

/**
 * @Description AlertDataController
 * @Author mks
 * @Date 2024-09-15
 */
@Slf4j
@RestController
@RequestMapping("/alert-data")
@Api(tags = "管理端 - 报警数据相关接口")
public class AlertDataController extends BaseController{

    @Autowired
    private AlertDataService alertDataService;

    @GetMapping("/pageQuery")
    @ApiOperation(value = "分页查询报警数据")
    public ResponseResult<PageResponse<AlertDataVo>> pageQuery(AlertDataPageQueryDto alertDataPageQueryDto){
        PageResponse<AlertDataVo> pageResponse = alertDataService.pageQuery(alertDataPageQueryDto);
        return success(pageResponse);
    }

    @PutMapping("/handleAlertData/{id}")
    @ApiOperation(value = "处理设备报警数据")
    public ResponseResult<Void> handleAlertDataId(
            @RequestBody AlertDataHandleDto alertDataHandleDto,
            @PathVariable Long id){
        alertDataService.handleAlertDataId(alertDataHandleDto,id);
        return success();
    }

}
